You don't have permission to access root on this serv

chris (2004-07-19 19:50:30)
69518 views
4 replies
Forbidden You don't have permission to access / on this server.

This is common error with new Apache installations and I often get asked how to fix it. The answer is simple, but first just to clarify what it means..

This doesn't mean that apache is trying to access '/' on the unix machine - it's referring to the DocumentRoot. The reason that it's trying to access the document root is that you have asked it for a file that doesn't exist, so instead it's trying to pull up a directory listing. Apache is then failing to list the directory contents, because it hasn't been set up to do so. There are two fixes to this.

The first (and safest) fix is to fix the bad link into the site, or the wrongly posted URL or whatever is causing the missing file in the first place. With new Apache installations, this is usually just a simple case of making sure your index page is called index.html and not index.htm or index.jsp or index.php or whatever. A Vanilla build of apache looks for index.html and complains if it can't find it.

The second fix is to enable alternative index page naming conventions on your webserver. This requires a simple change to the httpd.conf (so you must be logged in with superuser permissions). All you need to do is add the following line to the httpd.conf:

DirectoryIndex index.html

If you like you can really go to town by adding all sorts of other index name options like so:

DirectoryIndex index.html index.php index.sh default.jsp

Note that if more than one possible convention is permitted, Apache will look for each on in turn from the beginnning of the list, so in the example given in the line above, if both index.php and index.jsp exist, the webserver will load index.php. Overcome this simply by adjusting their order of occurenc in the httpd.conf.

And don't forget to restart the webserver after the changes have been made. First check the syntax of your httpd.conf with

apachectl configtest

and then restart with

apachectl graceful

Hope that's useful,

christo


follow me on twitter: http://www.twitter.com/planet_guru
comment
chris
2008-04-21 22:27:40

Directory Access

It's also worth mentioning that this could also be caused by a <Directory> directive in the Apache config. This has been toughened in recent Apache versions, so check that your VirtualHost has a section like the following:

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        allow from all
</Directory>

Note that the last line says 'allow from all'. The default access configuration for your document root probably ends 'deny from all', which will deny access to your server root, so you will need to open this up within your individual Virtual Hosts.


christo
reply icon
anonymous
2008-09-06 12:11:57

Forbidden You don't have permission to access / on this server.

This is common error with new Apache installations and I often get asked how to fix it. The answer is simple, but first just to clarify what it means..

This doesn't mean that apache is trying to access '/' on the unix machine - it's referring to the DocumentRoot. The reason that it's trying to access the document root is that you have asked it for a file that doesn't exist, so instead it's trying to pull up a directory listing. Apache is then failing to list the directory contents, because it hasn't been set up to do so. There are two fixes to this.

The first (and safest) fix is to fix the bad link into the site, or the wrongly posted URL or whatever is causing the missing file in the first place. With new Apache installations, this is usually just a simple case of making sure your index page is called index.html and not index.htm or index.jsp or index.php or whatever. A Vanilla build of apache looks for index.html and complains if it can't find it.

The second fix is to enable alternative index page naming conventions on your webserver. This requires a simple change to the httpd.conf (so you must be logged in with superuser permissions). All you need to do is add the following line to the httpd.conf:

DirectoryIndex index.html

If you like you can really go to town by adding all sorts of other index name options like so:

DirectoryIndex index.html index.php index.sh default.jsp

Note that if more than one possible convention is permitted, Apache will look for each on in turn from the beginnning of the list, so in the example given in the line above, if both index.php and index.jsp exist, the webserver will load index.php. Overcome this simply by adjusting their order of occurenc in the httpd.conf.

And don't forget to restart the webserver after the changes have been made. First check the syntax of your httpd.conf with

apachectl configtest

and then restart with

apachectl graceful

Hope that's useful,

christo
reply iconedit reply
anonymous
2009-08-25 15:51:40

THANK YOU >>>>>>>



Forbidden You don't have permission to access / on this server.

This is common error with new Apache installations and I often get asked how to fix it. The answer is simple, but first just to clarify what it means..

This doesn't mean that apache is trying to access '/' on the unix machine - it's referring to the DocumentRoot. The reason that it's trying to access the document root is that you have asked it for a file that doesn't exist, so instead it's trying to pull up a directory listing. Apache is then failing to list the directory contents, because it hasn't been set up to do so. There are two fixes to this.

The first (and safest) fix is to fix the bad link into the site, or the wrongly posted URL or whatever is causing the missing file in the first place. With new Apache installations, this is usually just a simple case of making sure your index page is called index.html and not index.htm or index.jsp or index.php or whatever. A Vanilla build of apache looks for index.html and complains if it can't find it.

The second fix is to enable alternative index page naming conventions on your webserver. This requires a simple change to the httpd.conf (so you must be logged in with superuser permissions). All you need to do is add the following line to the httpd.conf:

DirectoryIndex index.html

If you like you can really go to town by adding all sorts of other index name options like so:

DirectoryIndex index.html index.php index.sh default.jsp

Note that if more than one possible convention is permitted, Apache will look for each on in turn from the beginnning of the list, so in the example given in the line above, if both index.php and index.jsp exist, the webserver will load index.php. Overcome this simply by adjusting their order of occurenc in the httpd.conf.

And don't forget to restart the webserver after the changes have been made. First check the syntax of your httpd.conf with

apachectl configtest

and then restart with

apachectl graceful

Hope that's useful,

christo
reply iconedit reply
Annon
2010-04-28 15:59:11

THANKS!

THANK YOU SO MUCH!!


It's also worth mentioning that this could also be caused by a <Directory> directive in the Apache config. This has been toughened in recent Apache versions, so check that your VirtualHost has a section like the following:

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        allow from all
</Directory>

Note that the last line says 'allow from all'. The default access configuration for your document root probably ends 'deny from all', which will deny access to your server root, so you will need to open this up within your individual Virtual Hosts.


christo
reply iconedit reply